﻿using FRMS.BUS;
using FRMS.Model;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;

namespace FRMS.DAL
{
    public class DataFactory
    {
        private static string MYSQLCONNSTR = string.Empty;
        private static string SQLSERVERCONNSTR = string.Empty;
        private static string OAMYSQLCONNSTR = string.Empty;
        public static IDbConnection GetSQLConnection()
        {
            IDbConnection connection;
            if (MYSQLCONNSTR == string.Empty)
            {
                MYSQLCONNSTR = AppSettingsHelper.Configuration["MySqlConnectionString"];
            }
            connection = new MySqlConnection(MYSQLCONNSTR);
            return connection;
        }

        public static IDbConnection GetSQLServerConnection()
        {
            IDbConnection connection;
            if (SQLSERVERCONNSTR == string.Empty)
            {
                SQLSERVERCONNSTR = AppSettingsHelper.Configuration["KqMySqlConnectionString"];
            }
            connection = new SqlConnection(SQLSERVERCONNSTR);
            return connection;
        }

        public static IDbConnection GetOASQLConnection()
        {
            IDbConnection connection;
            if (OAMYSQLCONNSTR == string.Empty)
            {
                OAMYSQLCONNSTR = AppSettingsHelper.Configuration["OAMySqlConnectionString"];
            }
            connection = new MySqlConnection(OAMYSQLCONNSTR);
            return connection;
        }
    }
}
